package IOperation;

import Book.BookList;

import java.util.Scanner;

public class findOperation implements IOperation{


    @Override
    public void work(BookList bookList) {
        System.out.println("找书");
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入你要找的书名");
        String name = scanner.nextLine();
        for (int i = 0; i < bookList.getBookSize(); i++) {
            if(bookList.getBook(i).getName().equals(name)){
                System.out.println("找到了这本书，他是：");
                System.out.println(bookList.getBook(i));
                return;
            }
        }
        System.out.println("没找到，不存在这本书");

    }
}
